﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EmployeePractice
{
    class Worker:Employee
    {
        public Worker(string srtName, int yearSalary):base(srtName)
        {
            YearSalary = yearSalary;
        }
        private int yearSalary;
        public int YearSalary
        {
            get { return yearSalary; }
            set
            {
                if (value < 0)
                    throw new ArgumentOutOfRangeException("Wrong year salary!");
                yearSalary = value;
            }
        }
        public override void CalculateSalary()
        {
            Console.WriteLine("{0} salary is: ${1}", Name, YearSalary/12);
        }
    }
}
